package com.eagle.functioninterface;

import org.junit.Test;

import java.util.Objects;
import java.util.function.BiConsumer;

/**
 * {@link java.util.function.BiConsumer} 函数式接口的形式是 (x,y) -> void
 *
 * @author qinlinsen
 */
public class BiConsumerTest10 {
    @Test
    public void testBiConsumer() {
        biConsumer("hello",
                "world",
                (x, y) -> System.out.println(x + y));
    }

    private <T, U> void biConsumer(T x, U y, BiConsumer<T, U> consumer) {
        Objects.requireNonNull(x);
        Objects.requireNonNull(y);
        Objects.requireNonNull(consumer);
        consumer.accept(x, y);
    }
}
